const {Service}=require("egg")

class interfaceService extends Service{

    // 查看
    async show(id){
        const sql=`select * from auth_interface where interface_id=?`
        return await this.app.mysql.query(sql,[id])
    }

    // 编辑
    async update(id,interface_text,methods,interface_url){
        const sql=`update auth_interface set interface_text=?,methods=?,interface_url=? where interface_id=?`
        return await this.app.mysql.query(sql,[interface_text,methods,interface_url,id])
    }

    // 删除
    async destroy(id){
        const sql=`DELETE FROM auth_interface WHERE interface_id=?`
        return await this.app.mysql.query(sql,[id])
    }

    // 增加
    async create(id,interface_text,methods,interface_url){
        const sql=`insert into auth_interface (interface_id,interface_text,methods,interface_url) values (?,?,?,?)`
        return await this.app.mysql.query(sql,[id,interface_text,methods,interface_url])
    }
}

module.exports=interfaceService